﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>添加新会员</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="/style/admin/style/adminStyle.css" rel="stylesheet" type="text/css" />
        <script src="/style/admin/js/jquery.js"></script>
    </head>
    <body>
        <div class="wrap">
            <div class="page-title">
                <span class="modular fl"><i class="add_user"></i><em>添加新会员</em></span>
            </div>
            <form action="" id="AddForm"  onsubmit="return false">
                <table class="list-style">
                    <tr>
                        <td style="width:15%;text-align:right;">会员昵称：</td>
                        <td><input type="text" name="name" class="textBox length-middle"/></td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">会员邮箱：</td>
                        <td><input type="text" name="email" class="textBox length-middle"/></td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">设置密码：</td>
                        <td><input type="password" name="pass" class="textBox length-middle"/></td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">手机号码：</td>
                        <td><input type="text" name="tel" class="textBox length-middle"/></td>
                    </tr>
                    <tr>
                        <td style="text-align:right;"></td>
                        <td><input type="submit" onclick="UserAdd();" class="tdBtn" value="添加新用户"/></td>
                    </tr>
                </table>
            </form>
        </div>
        <script>
               function UserAdd(){
                  str=$("#AddForm").serialize();
                  $.post(
                         '/admin/users',
                         {str:str,'_token':"{{csrf_token()}}",'method':"post"},
                         function(data){
                              if(data==1){
                                  window.location.href="/admin/users";
                              }else{
                                 if(data.name){
                                     alert(data.name);
                                     return false;
                                 }
                                 if(data.pass){
                                     alert(data.pass);
                                     return false;
                                 }
                              }
                         }
                );
               }
        </script>
    </body>
</html>